package com.qk.common.util;

/**
 * @author: Enid
 * @date: 2025/10/14 18:35
 * @description:
 * 制作ThreadLocal工具类共享当前用户信息
 */
public class CurrentUserContextHolders {
    //饿汉单例模式
    private static final ThreadLocal<Integer> USER_CONTEXT = new ThreadLocal<>();
    private CurrentUserContextHolders(){}

    public static void set(Integer id){
        USER_CONTEXT.set(id);
    }

    public static Integer get(){
        return USER_CONTEXT.get();
    }

    public static void remove(){
        USER_CONTEXT.remove();
    }

}
